package org.squabble.domain;

import java.io.Serializable;
import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity(name = "flag")
@Table(name = "FLAG")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Flag extends AbstractType implements Serializable {

	private static final long serialVersionUID = 7525470190382088284L;

	@Column(name = "USER_SELECTABLE")
	private boolean userSelectable;

	@ManyToMany
	@JoinTable(name = "REMARK_FLAG", joinColumns = { @JoinColumn(name = "FLAG_ID") }, inverseJoinColumns = { @JoinColumn(name = "REMARK_ID") })
	private Set<Comment> comments = new LinkedHashSet<Comment>();

	public boolean isUserSelectable() {
		return userSelectable;
	}

	public void setUserSelectable(boolean userSelectable) {
		this.userSelectable = userSelectable;
	}

	public Set<Comment> getRemarks() {
		return comments;
	}

	public void setRemarks(Set<Comment> comments) {
		this.comments = comments;
	}

}
